/*
 * @Date: 2025-04-22 16:01:15
 * @Auth: 873768511@qq.com
 * @LastEditors: 873768511@qq.com
 * @LastEditTime: 2025-09-08 15:23:33
 * @FilePath: \corpus\src\pages\catalogue\detail\components\BasicInfo\index.tsx
 */

import ContainerConfigureInfo from '../ContainerConfigureInfo';
import { Descriptions, } from 'antd';
import Container from '../../hooks';
export default () => {
  const {
    detailsData: { data },
  } = Container.useContainer();
  const getParseJson = (data: string | undefined) => {
    if (!data) return '-'
    try {
      const arr = JSON?.parse(data)?.map((item: { id: string; name: string }) => item?.name)
      return arr.join('、')
    } catch (error) {
      return data
    }
  }
  return (
    <>
      <ContainerConfigureInfo title="基础信息">
        <Descriptions column={2}>
          <Descriptions.Item label="数据资源名称"> {data?.tableNameCn ?? '-'}</Descriptions.Item>
          <Descriptions.Item label="数据资源编码">{data?.tableNameEn ?? '-'}</Descriptions.Item>
          <Descriptions.Item label="数据资源提供方">{data?.sourceOrgName ?? '-'}</Descriptions.Item>
          <Descriptions.Item label="创建人">{data?.sourceOrgName ?? '-'}</Descriptions.Item>
        </Descriptions>
      </ContainerConfigureInfo>
      <ContainerConfigureInfo title="目录属性">
        <Descriptions column={2}>
          <Descriptions.Item label="创建时间">{data?.gmtCreate ?? '-'}</Descriptions.Item>
          <Descriptions.Item label="更新频率">{data?.refreshFreqName ?? '-'}</Descriptions.Item>
          <Descriptions.Item label="数据领域分类"> {data?.baseLibraryName ?? '-'}</Descriptions.Item>
          <Descriptions.Item label="关联应用目录">{getParseJson(data?.apps)}</Descriptions.Item>
          <Descriptions.Item label="数据敏感等级">{data?.sensitiveLevel ?? '-'}</Descriptions.Item>
          <Descriptions.Item label="数据来源方">{data?.createNick ?? '-'}</Descriptions.Item>
          <Descriptions.Item label="使用的数据目录">{data?.syncTime ?? '-'}</Descriptions.Item>
          <Descriptions.Item label="数据资源摘要">{data?.syncTime ?? '-'}</Descriptions.Item>
        </Descriptions>
      </ContainerConfigureInfo>
    </>
  );
};
